package world.hezi.http;

import net.mamoe.mirai.message.data.Image;
import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import world.hezi.callback.TencentPicturesHttpCallback;
import world.hezi.entity.PicInfo;
import world.hezi.mapper.PicInfoMapper;

public class GetPicturesCache {
    public static void saveCache(String uuid, PicInfoMapper picInfoMapper, PicInfo picInfo){
        String url = Image.queryUrl(Image.fromId(uuid));
        OkHttpClient okHttpClient = new OkHttpClient();
        final Request request = new Request.Builder()
                .url(url)
                .get()
                .build();
        Call call = okHttpClient.newCall(request);
        call.enqueue(new TencentPicturesHttpCallback(uuid,picInfoMapper, picInfo));
    }
}
